﻿app.views.Profile = Ext.extend(Ext.Panel, {
    items: [{
        xtype: 'toolbar',
        title: 'Profile'

    },
    {
        type: 'hbox',
        align: 'stretch',
        items:[
            //Needs to populate info according to UserStore
            {
                xtype: 'fieldset',
                title: "<img style= 'float:left;width:25px;height:25px;margin-right:5px' src='../../lib/resources/img/AmmoBear.png'>About me",
                store: userStore,
                items: [

                        {
                            xtype: 'textfield',
                            label: 'Name',
                            value: 'Aaron West'
                        },
                        {
                            xtype: 'textfield',
                            label: 'Email',
                            value: 'Aarondwest@aol.com'
                        },
                        {
                            xtype: 'textfield',
                            label: 'Phone #',
                            value: '817-366-9034'
                        }
                ]
            }
        ]
    },
    {
        xtype: 'fieldset',
        title: 'Previous Eats',
        items: [{
        
            xtype: 'list',
            disableSelection: true,
            id: 'views.Profile.proList',
            store: restaurantStore,
            title: 'Previous Eats',
            scroll: true,
            height: '77%',
            activeCls: 'list-item-active', // Used for swipe-delete button
            scope: this,
            element: null, // Stores the currently visible delete button

            itemTpl: [
                '<tpl for=".">',
                '<div class="newscontainer">',
                "<img style='float:left;width:70px;height:70px;margin:5px 10px 5px 0' src='{IMAGE_LOCATION}'/>",
            //'<div class="image"><img width="50" src="{imageUrl}" /></div>',
                '<h2><b>{RESTAURANT_CATEGORY_NAME}</b></h2>',
                '<p>{STREET_ADDRESS1}<br>{CITY}, {STATE}</p>',
                '</div>',
                '</tpl>'
            ],

            // Deletes list item if tapped, hides it if anything else is tapped
            onItemTap: function (item, index, e) {
                Ext.getCmp('backButton').prevCard = app.views.profile;
                Ext.dispatch({
                    controller: app.controllers.navigation,
                    action: 'showRestaurantDetails',
                    record: restaurantStore.getAt(index)
                });
            },
            // Hides all visible delete buttons
            deactivateAll: function () {
                if (this.element && this.element.hasCls(this.activeCls)) {
                    this.element.removeCls(this.activeCls);
                }
            }
       }]
    }]
});